package com.huawei.fastengine.fastview.startFastappEngine.storage;

import android.content.Context;
import android.content.SharedPreferences;

public class FastAppPreferences {
    private static final String FASTAPP_PREFERENCES_NAME = "FastAppPrefs";
    public static final String KEY_ACTIONBAR_LOCK_CUSTOMIZE = "actionbar_lock_customize";
    public static final String KEY_ACTIONBAR_LOCK_STATUS = "actionbar_lock_status";
    public static final String KEY_AGREEMENT_VERSION = "agreement_version";
    public static final String KEY_CREATESHORTCUT = "creat_shortcut";
    private static final byte[] SYNC_LOCK = new byte[0];
    private static volatile FastAppPreferences instance = null;
    private SharedPreferences sp = null;

    private FastAppPreferences(Context context) {
        this.sp = context.getApplicationContext().getSharedPreferences(FASTAPP_PREFERENCES_NAME, 0);
    }

    public static FastAppPreferences getInstance(Context context) {
        if (instance == null) {
            synchronized (SYNC_LOCK) {
                if (instance == null) {
                    instance = new FastAppPreferences(context);
                }
            }
        }
        return instance;
    }

    public boolean getBoolean(String str, boolean z) {
        return this.sp.getBoolean(str, z);
    }

    public int getInt(String str, int i) {
        return this.sp.getInt(str, i);
    }

    public Long getLong(String str, Long l) {
        return Long.valueOf(this.sp.getLong(str, l.longValue()));
    }

    public String getString(String str, String str2) {
        return this.sp.getString(str, str2);
    }

    public boolean putBoolean(String str, boolean z) {
        return this.sp.edit().putBoolean(str, z).commit();
    }

    public boolean putInt(String str, int i) {
        return this.sp.edit().putInt(str, i).commit();
    }

    public boolean putLong(String str, Long l) {
        return this.sp.edit().putLong(str, l.longValue()).commit();
    }

    public boolean putString(String str, String str2) {
        return this.sp.edit().putString(str, str2).commit();
    }

    public boolean remove(String str) {
        return this.sp.edit().remove(str).commit();
    }
}
